package cn.leven.web.response;

import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 *  输出流
*/
@WebServlet("/rdct3")
public class RedirectDemo3 extends HttpServlet {
    protected void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException {
        res.setContentType("text/html;charset=utf-8");
        ServletOutputStream sos = res.getOutputStream();
        sos.write("你好".getBytes("utf-8"));

//        pw.write("<h1>hello response</h1><p>你好</p>");
    }

    protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
        this.doPost(req,res);
    }
}
